package cn.syc.struck.demo;

import android.os.Bundle;
import android.support.design.widget.FloatingActionButton;
import android.support.design.widget.Snackbar;
import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar;
import android.view.View;

import cn.syc.struck.demo.base.BaseActivity;
import cn.syc.struck.demo.dummy.DummyContent;
import cn.syc.struck.demo.fragment.ItemFragment;

public class BasicActivity extends BaseActivity implements ItemFragment.OnListFragmentInteractionListener {

    @Override
    protected int getLayoutId() {
        return R.layout.activity_basic;
    }

    @Override
    protected void afterCreate(Bundle savedInstanceState) {
        Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
        setSupportActionBar(toolbar);
        //------------
        getSupportFragmentManager().beginTransaction().replace(R.id.fragment, ItemFragment.newInstance(1), "fragment").commit();
        //------------

        FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
        fab.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Snackbar.make(view, "Replace with your own action", Snackbar.LENGTH_LONG)
                        .setAction("Action", null).show();
            }
        });
    }

    @Override
    public void onListFragmentInteraction(DummyContent.DummyItem item) {

    }

}
